package com.hzhq.contract.repo;

import com.hzhq.contract.bean.entity.Attachment;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;
import java.util.Optional;

/**
 * @author hzhq
 * @create 2021/4/8 11:38 下午
 * @email hzhq1255@163.com
 */
public interface AttachmentRepository extends MongoRepository<Attachment, ObjectId> {

    List<Attachment> findByAttachIdInAndDeleted(List<ObjectId> ids, Integer deleted);

    Optional<Attachment> findByContractIdAndAttachIdAndDeleted(ObjectId contractId,ObjectId attachId,Integer deleted);

    Optional<Attachment> findByContractIdAndMd5AndDeleted(ObjectId contractId,String md5, Integer deleted);

}
